package com.study.singlemode;

public class Student2 {
    //2、定义一个类变量存储类的唯一对象
    private static Student2 student2;
    //1、把构造器私有
    private Student2(){
    }
    //3、定义一个静态方法获取类的唯一对象
    public static Student2 getStudent2(){
        if(student2==null){
          student2 = new Student2();
        }
            return student2;
    }
}
